import plotly.express as px
import pandas as pd
import numpy as np
fig=px.line(x=["india","australia","england"],y=[137,55,60])
fig.show()
import plotly.express as px
df=px.data.iris()
print(df.head())
sepal_length sepal_width petal_length petal_width species species_id 0 5.1 3.5 1.4 0.2 setosa 1 1 4.9 3.0 1.4 0.2 setosa 1 2 4.7 3.2 1.3 0.2 setosa 1 3 4.6 3.1 1.5 0.2 setosa 1 4 5.0 3.6 1.4 0.2 setosa 1
df=px.data.iris()
fig=px.line(df,x="species",y="sepal_length")
fig.show()
fig=px.histogram(df,x="species",y="sepal_length")
fig.show()
fig=px.scatter(df,x="species",y="sepal_length")
fig.show()
fig=px.bar(df,x="species",y="sepal_length")
fig.show()
fig=px.line(df,x="sepal_width",y="sepal_length",color="species")
fig.show()
fig=px.bar(df,x="sepal_width",y="sepal_length",color="species")
fig.show()
fig=px.box(df,x="species",y="sepal_length",color="species")
fig.show()
fig=px.violin(df,x="species",y="sepal_length",color="species")
fig.show()
fig=px.scatter_3d(df,x="species",y="sepal_length",z="sepal_width",color="species")
fig.show()
df=px.data.tips()
print(df)
total_bill tip sex smoker day time size 0 16.99 1.01 Female No Sun Dinner 2 1 10.34 1.66 Male No Sun Dinner 3 2 21.01 3.50 Male No Sun Dinner 3 3 23.68 3.31 Male No Sun Dinner 2 4 24.59 3.61 Female No Sun Dinner 4 .. ... ... ... ... ... ... ... 239 29.03 5.92 Male No Sat Dinner 3 240 27.18 2.00 Female Yes Sat Dinner 2 241 22.67 2.00 Male Yes Sat Dinner 2 242 17.82 1.75 Male No Sat Dinner 2 243 18.78 3.00 Female No Thur Dinner 2 [244 rows x 7 columns]
import plotly.graph_objects as go
xd=np.random.randint(1,20,30)
yd=np.random.randint(1,20,30)
fig=go.Figure(go.Scatter(x=xd,y=yd,mode="markers"))
fig.show()
fig=go.Figure(go.Scatter(x=xd,y=yd,mode="markers",fillcolor="red"))
fig.show()
fig=go.Figure(go.Pie(labels=xd,values=yd ))
fig.show()
fig=px.line(x=["potato","tomato","capsium","onion","garlic","chilly"],y=[180,155,170,190,167,177])
fig.show()
fig=px.bar(x=["potato","tomato","capsium","onion","garlic","chilly"],y=[180,155,170,190,167,177])
fig.show()
fig=px.scatter(x=["potato","tomato","capsium","onion","garlic","chilly"],y=[180,155,170,190,167,177])
fig.show()
fig=go.Figure(go.Pie(labels=["potato","tomato","capsium","onion","garlic","chilly"],values=[18,155,250,190,100,177],title="SuperMarket"))
fig.show()